/**
 *  弹出框
 */
import React, { Component } from 'react';
import styles from './index.less';
import { Button, Modal } from 'antd';

export default class extends Component {
  static defaultProps = {
    visible: false,
    title: 'title',
    width: '800px',
    moreConfig: {},
    onOk: () => {},
    close: () => {},
  };
  close = () => {
    this.props.close();
  };
  onOk = () => {
    this.props.onOk();
  };
  render() {
    const { visible } = this.props;
    return (
      <Modal
        title={this.props.title}
        width={this.props.width}
        maskClosable={false}
        visible={visible}
        onCancel={this.close}
        centered={true}
        destroyOnClose={true}
        footer={
          <div className={styles.footer}>
            <Button onClick={this.close}>取消</Button>
            <Button onClick={this.onOk} type="primary">
              确认
            </Button>
          </div>
        }
        {...this.props.moreConfig}
      >
        {this.props.children}
      </Modal>
    );
  }
}
